package org.chl.chapter05.controller;

import java.util.List;


import org.chl.chapter05.dao.BookDao;
import org.chl.chapter05.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("book")
public class MultiBookController {
	
	@Autowired
	BookDao bookDao;

    @GetMapping("/testAll")
    public List<Book> test1() {
    	Book book = new Book();
    	book.setAuthor("diyee");
    	book.setName("book_name_" + System.currentTimeMillis());
    	bookDao.addBook(book);
    	
    	return bookDao.getAllBooks();
    }
}
